home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 21 / AACD 21.iso / AACD / Games / ShogoDemo / help.rx < prev    next >
Encoding:
Text File  |  2001-04-02  |  4.0 KB  |  205 lines

  1. /* AREXX Script to ask to configure the browser */
  2.  
  3.  
  4. OPTION RESULTS
  5.  
  6. if ~exists("ENV:ShogoDemo") then
  7. do
  8.     address command 'makedir env:ShogoDemo'
  9.     address command 'makedir envarc:ShogoDemo'
  10. end
  11.  
  12. if ~exists("ENV:ShogoDemo/Browser") then
  13. do
  14.     call main()
  15. end
  16.  
  17. i = open("f", "ENV:ShogoDemo/Browser", "READ")
  18. if i = 0 then
  19. do
  20.     address command 'RequestChoice TITLE "Error" BODY "Cannot get browser info" GADGETS "Abort"'
  21.     return
  22. end
  23.  
  24. line = readln("f")
  25. line = line || '"file://localhost/' || pragma("d") || '/README.html"'
  26. address command line
  27.  
  28. return
  29.  
  30. getresult: procedure
  31.     if open("f", "t:h2w", "READ") = 1 then do
  32.     line = readln("f")
  33.     call close("f")
  34.     return line
  35.     end
  36.     return ""
  37.  
  38.  
  39. GetChoice: Procedure
  40.     parse arg list,gads
  41.  
  42.     string = "I have determined that you have the following browsers installed:*n"
  43.     string = string || list
  44.     string = string || "*nPlease select which one you want to use:"
  45.  
  46.     address command 'RequestChoice >t:h2w TITLE "Browser Selection" BODY "'||string||'" GADGETS "'||gads||'"'
  47.     return
  48.  
  49. WriteEnv: Procedure
  50.     parse arg what
  51.  
  52.     if ~exists("ENV:ShogoDemo") then
  53.     do
  54.     call MakeDir("ENV:ShogoDemo")
  55.     call MakeDir("ENVARC:ShogoDemo")
  56.     end
  57.  
  58.     i = open("a","ENV:ShogoDemo/Browser","WRITE")
  59.     if i = 0 then return
  60.  
  61.     call writeln("a", what)
  62.     call close("a")
  63.  
  64.     i = open("a","ENVARC:ShogoDemo/Browser","WRITE")
  65.     if i = 0 then return
  66.  
  67.     call writeln("a", what)
  68.     call close("a")
  69.     
  70.     return
  71.  
  72.  
  73. main: Procedure
  74.     /* Check for IBrowse in the path */
  75.     address command 'which IBrowse >t:h2w'
  76.     ib = getresult()
  77.  
  78.     /* Check for WORK:Ibrowse/IBrowse */
  79.     if ib = "" then
  80.     do
  81.     call pragma("Window", "Null")
  82.     if exists("WORK:Ibrowse/IBrowse") then
  83.         ib = "WORK:IBrowse/IBrowse"
  84.     call pragma("Window", "WorkBench")
  85.     end
  86.  
  87.     /* Check for SYS:Ibrowse/ibrowse */
  88.     if ib = "" then
  89.     do
  90.     call pragma("Window", "Null")
  91.     if exists("SYS:Ibrowse/IBrowse") then
  92.         ib = "SYS:IBrowse/IBrowse"
  93.     call pragma("Window", "WorkBench")
  94.     end
  95.  
  96.  
  97.     address command 'which Aweb-II >t:h2w'
  98.     aweb = getresult()
  99.  
  100.     /* Check for OS 3.5 default installation */
  101.     if aweb = "" then
  102.     do
  103.     call pragma("Window", "Null")
  104.     if exists("sys:Internet/AWeb3SE/AWeb-II") then
  105.         aweb = "sys:Internet/AWeb3SE/AWeb-II"
  106.     call pragma("Window", "WorkBench")
  107.     end
  108.  
  109.     address command 'which V >t:h2w'
  110.     voyager = getresult()
  111.  
  112.     /* Check for Work:Voyager/V */
  113.     if voyager = "" then
  114.     do
  115.     call pragma("Window", "Null")
  116.     if exists("work:Voyager/V") then
  117.         voyager = "Work:Voyager/V"
  118.     call pragma("Window", "WorkBench")
  119.     end
  120.  
  121.     /* Verify that what we found as 'V' is really voyager */
  122.     if voyager ~= "" then
  123.     do
  124.     address command 'version '||voyager||' >t:h2w'
  125.     vers = getresult()
  126.     parse upper var vers prog .
  127.     if prog ~= "VOYAGER" then
  128.         voyager = ""
  129.     end
  130.  
  131.     list = ""
  132.     gads = ""
  133.     sym  = ""
  134.  
  135.     if ib ~= "" then
  136.     do
  137.     list = "IBrowse"
  138.     gads = "IBrowse"
  139.     sym  = "I"
  140.     end
  141.  
  142.     if aweb ~= "" then
  143.     do
  144.     list = list||" AWeb"
  145.     gads = gads||"|AWeb"
  146.     sym = sym||"A"
  147.     end
  148.  
  149.     if voyager ~= "" then
  150.     do
  151.     list = list||" Voyager"
  152.     gads = gads||"|Voyager"
  153.     sym = sym||"V"
  154.     end
  155.  
  156.     if left(gads,1,1) = "|" then
  157.     do
  158.     gads = substr(gads,2)
  159.     list = substr(list,2)
  160.     end
  161.  
  162.     ch = ""
  163.  
  164.     if gads ~= "" then
  165.     do
  166.     gads = gads||"|Let me choose"
  167.     call GetChoice(list,gads)
  168.     res = getresult()
  169.     if res = "0" then
  170.         ch = ""
  171.     else
  172.         ch = substr(sym, res,1)
  173.     end
  174.  
  175.     if gads = "" | ch = "" then
  176.     do
  177.     address command 'RequestFile >t:h2w TITLE "Select your Browser..." POSITIVE "Use this program" NEGATIVE "Abort" DRAWER "SYS:"'
  178.     line = getresult()
  179.     if line ~= "" then
  180.     do
  181.         line = substr(line, 2, length(line)-2)
  182.         ch = " "
  183.     end
  184.     end
  185.  
  186.     select
  187.     when ch = "I" then
  188.         cmdline = ib || " URL "
  189.     when ch = "A" then
  190.         cmdline = aweb || " URL "
  191.     when ch = "V" then
  192.         cmdline = voyager || " URL "
  193.     when ch = " " then
  194.         cmdline = line||" "
  195.     otherwise
  196.         return
  197.     end
  198.  
  199.     call WriteEnv(cmdline)
  200.  
  201.     return
  202.  
  203.  
  204.  
  205.